<?php
namespace App\Model;

class Product extends Model
{
    // 表名
    protected $table = 'products';
    
    // 保护属性
    protected $guarded = [];
    
    // 格式
    protected $casts = [
        'images' => 'array'
    ];
    
    protected $dateFormat = 'U';
    
    // 分类
    public function menu()
    {
        return $this->belongsTo(ProductMenu::class, 'menu_id');
    }
    
    // 代理
    public function daili()
    {
        return $this->belongsTo(Daili::class, 'daili_id');
    }
}